<template>
	<view class="content">
		<view class="padding_lrb nav">
			<!-- 空白页 -->
			<!-- <view class="placeholderimg zwtimg" style="margin-top: 300rpx;" v-if="!list.data.length">
				<image src="../static/image/bg-icons/placeholderimg.png" mode=""></image>
			</view> -->
			<view class="ffffff  padding  margin_top border" v-for="item in list.data" :key="item.id"
				v-if="list.data.length">
				<view class="flexbetween">
					<view class="flexleft">
						<view class="pjslt margin_right2">
							<image :src="item.user.avatar_text" mode="" class="touxiang"></image>
						</view>
						<view class="">
							<view class="bigbtext">{{item.user.nickname}}</view>
							<view class="flexleft margin_top1">
								<view class="wujiaox margin_right1" v-for="ite in item.score_describe"></view>
							</view>
						</view>
					</view>
					<view class="word_rl liu">{{item.createtime_text}}</view>
				</view>
				<view class="margin_top2">
					<view class="word_rl liu">{{item.content}}</view>
					<view class="flexleft margin_top">
						<view class="mjplt  margin_right1" v-for="(ite,index) in item.images_text" :key="ite"
							@click="lbtpriview(index,item.images_text)">
							<image :src="ite" mode="" @></image>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				lastmsg: {
					goods_id: ""
				},
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onLoad(options) {
			let _this = this
			_this.lastmsg.goods_id = options.goods_id
		},
		onShow() {
			this.init()
		},
		methods: {
			lbtpriview(index, arr) {
				var i = arr; //获取当前页面的轮播图数据
				//uniapp预览轮播图
				uni.previewImage({
					current: index, //预览图片的下标
					urls: i //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
				})
			},
			init(isPage, page) {
				let _this = this;
				httpRequest.request('api/goods/goodsCommentList', 'GET', {
					page: page || 1,
					limit: _this.limit,
					goods_id: this.lastmsg.goods_id
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.mjplt {
		width: 140rpx;
		height: 140rpx;
		border-radius: 18rpx;

		image {
			width: 100%;
			height: 100%;
			border-radius: 18rpx;
		}
	}

	.nav {
		padding-bottom: 100rpx;
	}

	.content {
		overflow: hidden;
	}

	.imgs {
		width: 152rpx;
		height: 152rpx;
		border-radius: 18rpx;
	}

	.touxiang {
		width: 73rpx;
		height: 73rpx;
		border-radius: 50%;
	}

	.wujiaox {
		width: 27rpx;
		height: 27rpx;
		background-size: 100% 100%;
		background-image: url('/static/image/home/collect_star.png');
	}
</style>